home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************
- *
- * NSSDC/CDF Utility functions.
- *
- * Version 2.0, 27-Feb-92, ST Systems (STX)
- *
- * Modification history:
- *
- * V1.0 29-Jan-91, D Grogan Original version (for CDF V2.0).
- * H Leckner
- * V1.1 15-Mar-91, H Leckner Added PF keys to cause exit from function.
- * V1.2 25-Jun-91, H Leckner Fix for Iris console. Removed 'prtext'.
- * J Love
- * V1.3 28-Jun-91, J Love TRUE/FALSE. Changed 'string_count' so it
- * doesn't execute NULL (whatever that does).
- * V2.0 27-Feb-92, J Love Modified for IBM-PC port. CDF V2.2.
- * H Leckner
- *
- ******************************************************************************/
-
- /*
- * MODULE: UTILITY.C for WFL
- */
-
- /*
- * MODS to UTILITY.C --
- * Reworked, enhanced input_field() and get_input()
- *
- * 2 new functions added to UTILITY.C --
- * For getting and setting the physical cursor.
- *
- * 2 new functions added to UTILITY.C --
- * For set-save the menu-bar row and column position.
- *
- * Comparable functions added to the SMG_GLUE_C.C under-layer.
- * Dan Grogan, October 1988.
- */
-
- #include <string.h>
-
- #include "wfl.h"
- #include "cdfdist.h"
- #include "kb_def.h"
- #include "utility.h"
-
- void redraw_screen ()
-
- /*
- * This function refreshes the screen identified by pbid.
- */
- /*CodeRef-mark*/
- {
- repaint_screen();
- }
-
- /*CodeRef-mark*/
-
- void place_cursor_abs (vid, row, col)
- WINDOWid vid;
- int row;
- int col;
-
- /*
- * NOT SURE OF THIS ONE (dg). Absolute or relative cursor?
- */
- /*CodeRef-mark*/
- {
- set_cursor_abs (vid, row, col);
- }
-
-
-
- /*CodeRef-mark*/
-
- void place_cursor_rel (vid, num_rows, num_cols)
- WINDOWid vid;
- int num_rows;
- int num_cols;
-
- /*
- * NOT SURE OF THIS ONE (dg). not sure it works.
- */
- /*CodeRef-mark*/
- {
- set_cursor_rel (vid, num_rows, num_cols);
- }
-
-
-
- /*CodeRef-mark*/
-
-
- #if defined(vms)
- void get_input(value, keyWas)
- #else
- void get_input(id, value, keyWas)
- WINDOWid id;
- #endif
-
- /*id = int vdid; Current window for curses UNIX */
-
- char *value; /* Actual scancode value of the key */
- /* struck by user -- output */
- int *keyWas; /* Filtered key code for WFL, */
- /* eg, ALPHA, PF1, SELECT, etc. */
- /*
- * SINGLE-POINT-OF-INPUT for all WFL via call to read_input().
- * All keys are filtered first in this function.
- */
- /*CodeRef-mark*/
- {
- int scancode;
- #if defined(vms)
- read_input (&scancode);
- #else
- read_input (id, &scancode);
- #endif
- *value = (char)scancode;
-
- /* Check for ALPHA Key */
- if ((scancode >= 65 && scancode <= 90) ||
- (scancode >= 97 && scancode <= 122))
- *keyWas = ALPHA;
-
- /* Check for NUMERIC Key */
- else if (scancode >= 48 && scancode <= 57)
- *keyWas = NUMERIC;
-
- /* Check for SPECIAL CHAR Key */
- else if ((scancode >= 33 && scancode <= 47) ||
- (scancode >= 58 && scancode <= 64) ||
- (scancode >= 91 && scancode <= 96) ||
- (scancode >= 123 && scancode <= 126))
- *keyWas = SPECIAL;
-
- /* Check for SPACE Key */
- else if (scancode == KB_SPACE)
- *keyWas = SPACECHAR;
-
- /* Check for DELETECHAR Key */
- else if ((scancode == KB_DELETE) ||
- (scancode == KBF_BACKSPACE))
- *keyWas = DELETECHAR;
- #if defined(__MSDOS__)
- else if (scancode == KB_DEL_AND_STAY)
- *keyWas = DELSTAY;
- #endif
-
- else if (scancode == KBM_ENTER)
- *keyWas = KBM_SELECT;
-
- else if (scancode == KBF_ENTER)
- *keyWas = KBF_NEXTFIELD;
-
- /* major mods following <dan> */
- /* Check for any other valid user defined menu or form keystroke */
-
- else if (
- /* pass all keypad keys */
- ( (scancode >= KB_PF1) && (scancode <= KB_PAD_DOT) ) ||
-
- (scancode == KB_CONTEXT_HELP) ||
-
- (scancode == KBM_QUIT) ||
- (scancode == KBM_UP) ||
- (scancode == KBM_DOWN) ||
- (scancode == KBM_LEFT) ||
- (scancode == KBM_RIGHT) ||
- (scancode == KBM_SELECT) ||
- (scancode == KBM_EXIT) ||
- (scancode == KBM_BACK) ||
- (scancode == KBM_HELP) ||
- (scancode == KBM_PREVSCRN) || (scancode == KBM_prevscrn) ||
- (scancode == KBM_NEXTSCRN) || (scancode == KBM_nextscrn) ||
- (scancode == KBM_POPUP) ||
- (scancode == KBM_ACTION) ||
-
- (scancode == KBF_QUIT) ||
- (scancode == KBF_HELP) ||
- (scancode == KBF_TOGGLE_INSERT) ||
- /* (scancode == KBF_MOVE_SOL) || */
- (scancode == KBF_MOVE_EOL) ||
- (scancode == KBF_MOVE_SOL_ALT) ||
- (scancode == KBF_MOVE_EOL_ALT) ||
- (scancode == KBF_DEL_TO_EOL) ||
- (scancode == KBF_DEL_TO_SOL) ||
- (scancode == KBF_UP) ||
- (scancode == KBF_DOWN) ||
- (scancode == KBF_LEFT) ||
- (scancode == KBF_RIGHT) ||
- (scancode == KBF_EXIT) ||
- (scancode == KBF_NEXTFIELD) ||
- (scancode == KBF_PREVFIELD) ||
- (scancode == KBF_POPUP) ||
- (scancode == KBF_ACTION)
- )
- *keyWas = scancode;
-
-
- /* Check for REDRAW Key */
-
- else if (scancode == KB_REDRAW)
- *keyWas = REDRAW;
-
- /* UNDEFINED Key */
-
- else
- {
- /*
- * printf ("\n (UTILITY/get_input) : Undefined Key %3ld", scancode);
- */
- *keyWas = ERROR;
- }
-
- } /* end get_input */
-
-
-
- /*CodeRef-mark*/
-
-
-
- /*CodeRef-mark*/
- void fieldValToString(data, data_type, string_data, field_len)
- int *data;
- int data_type;
- char *string_data;
- int field_len;
- /*
- Convert the field value held in *data to a string according to its
- data_type.
- */
- /*CodeRef-mark*/
- {
- /*union ALLTYPES overlay;*/
-
- switch (data_type)
- {
- case DT_CHAR:
- sprintf (string_data, "%c", *data);
- break;
- case DT_STRING:
- strncpy (string_data, (char *) data, field_len);
- break;
- case DT_SHORTINT:
- sprintf (string_data, "%d", *data);
- break;
- case DT_LONGINT:
- sprintf (string_data, "%ld", *data);
- break;
- case DT_FLOAT:
- sprintf (string_data, "%f", *data);
- break;
- case DT_DOUBLE:
- sprintf (string_data, "%lf", *data);
- break;
-
- default:
- fprintf(stderr,
- "\n<UTILITY-fieldValToString> Bad data-type %ld",
- data_type);
- break;
- }
- } /* end fieldValToString */
-
-
-
- /*CodeRef-mark*/
- int stringToFieldVal(data, data_type, string_data, field_len)
-
- int *data;
- int data_type;
- char *string_data;
- int field_len;
- /*
- Convert the *string_data to a a field value in *data according to its
- data_type.
- */
- /*CodeRef-mark*/
- {
- int status = FALSE;
- union ALLTYPES overlay;
-
- switch (data_type)
- {
- case DT_CHAR:
- status = sscanf (string_data, "%c", data);
- break;
-
- case DT_STRING:
- strncpy ((char *) data, string_data, field_len);
- status = TRUE;
- break;
- case DT_SHORTINT:
- status = sscanf (string_data, "%d", data);
- break;
- case DT_LONGINT:
- status = sscanf (string_data, "%ld", data);
- break;
- case DT_FLOAT:
- status = sscanf (string_data, "%f", data);
- break;
-
- case DT_DOUBLE:
- status = sscanf (string_data, "%lf", &overlay.real8);
- memmove (data, &overlay.byte[0], 8);
- break;
-
- default:
- fprintf(stderr,
- "\n<UTILITY-stringToFieldVal> Bad data-type %ld",
- data_type);
- break;
- }
- return (status);
-
- } /* end stringToFieldVal */
-
-
- /*CodeRef-mark*/
-
- void input_field (vid, field, fieldRow, fieldCol, len, returnKey)
- WINDOWid vid;
- char field[];
- int fieldRow;
- int fieldCol;
- int len;
- int *returnKey;
-
-
- /*
- * This function controls the input of data in a field of a form.
- *
- * All keyboard input passes first through the get_input function
- * where it is filtered for illegal characters.
- * get_input returns two items to this function:
- * inChar, the numeric value (scancode) of the key that was pressed,
- * and keyWas, the coded signal that determines how input_field
- * will responds to the input.
- * The coded value keyWas is assigned to *returnKey.
- */
- /*CodeRef-mark*/
- {
- static long insertMode = FALSE; /* default - Overwrite mode */
- /*long curCol;*/
- char inChar;
- int keyWas;
- int done;
- int erase_mode;
- int video_type;
- int /*i,*/ j /*,k*/ ;
- char tempField[81];
- long cursorAt;
- long endAt;
- long tailLength;
- long cursorCol;
- int last_valid; /* last valid character to delete, depends on KEYSTROKE */
- /*char saveChar;*/
- /* Copy field to tempField, replacing all
- * nulls with blanks.
- */
- for (j=0; j<len; j++)
- {
- if (field[j] != '\0')
- tempField[j] = field[j];
- else
- tempField[j] = ' ';
- }
-
- /* Modes for the display of field */
- erase_mode = FALSE;
- video_type = REVERSE;
-
- /* Put real cursor at start of the field */
- place_cursor_abs (vid, fieldRow, fieldCol);
-
- /* Logical position of the cursor in the buffer
- * tempField is cursorAt; the end of the line is endAt.
- */
- cursorAt = 0;
- endAt = len -1;
-
- done = FALSE;
-
- while (!done)
- {
- /*
- Use current window to read from
- */
- #ifdef vms
- get_input (&inChar, &keyWas);
- #endif
- #if defined(unix) | defined(__MSDOS__)
- get_input (vid, &inChar, &keyWas);
- #endif
- /* inChar now holds the input character;
- * keyWas tells us what kind of character.
- */
-
- switch (keyWas)
- {
- case ALPHA: /* These are the regular chars */
- case NUMERIC:
- case SPECIAL: /* Special as in ! @ # $ % ^, etc. */
- case SPACECHAR:
-
- if (insertMode) /* We'll push all characters
- * right starting at the cursor.
- * Any char pushed off the end is lost.
- */
- {
-
- /* Push characters to the right;
- * (Or, rather, pull them from the end.)
- */
- for (j=endAt; j>cursorAt; j--)
- tempField[j] = tempField[j-1];
-
- /* put input character in the buffer at cursor */
- tempField[cursorAt] = inChar;
-
- /* Re-figure items for put_chars
- * tailLength is number of chars from cursor to end.
- * cursorCol is real cursor's position.
- */
- tailLength = endAt -cursorAt +1;
- cursorCol = fieldCol +cursorAt;
-
- /* re-write the tempField tail to the screen */
- put_chars (vid, &tempField[cursorAt],
- tailLength, fieldRow, cursorCol,
- erase_mode, video_type);
-
- if (cursorAt < endAt)
- cursorAt++;
-
- /* put the real cursor on the new current column */
- place_cursor_abs (vid, fieldRow, fieldCol +cursorAt);
-
- } /* end insert modee */
-
-
- else /* not insert mode (overwrite mode) */
- {
- /* put character in the tempField buffer */
- tempField[cursorAt] = inChar;
-
- /* Re-figure items for put_chars
- * Tail is just a single character in overwrite mode.
- * cursorCol is real cursor's position.
- */
- tailLength = 1;
- cursorCol = fieldCol +cursorAt;
-
- /* re-write the tempField tail to the screen */
- put_chars (vid, &tempField[cursorAt],
- tailLength, fieldRow, cursorCol,
- erase_mode, video_type);
-
- if (cursorAt < endAt)
- cursorAt++;
-
- /* put the real cursor on the new current column */
- place_cursor_abs (vid, fieldRow, fieldCol +cursorAt);
-
- } /* end not insert mode (overwrite mode) */
-
- /* end of character or number input */
- break;
-
-
- case KBF_DEL_TO_SOL: /* delete left of cursor to start */
-
- while
- (cursorAt > 0) /* can't delete left of field */
- {
- /* Move logical cursor to the doomed character
- */
- cursorAt--;
-
- /* shift chars left in buffer starting at
- * cursorAt +1
- */
- for (j=cursorAt; j<endAt; j++)
- tempField[j] = tempField[j+1];
-
- /* Hang a blank on the end to replace
- * the deleted character, so length
- * remains correct and the blanks
- * fill in the line from the right.
- */
- tempField[endAt] = ' ';
-
- } /* end while cursorAt > 0 */
-
- /* re-figure the tail of the line,
- * from cursorAt to endAt.
- */
- tailLength = endAt -cursorAt +1;
- cursorCol = fieldCol +cursorAt;
-
- /* re-write the tempField tail to the screen */
- put_chars (vid, &tempField[cursorAt],
- tailLength, fieldRow, cursorCol,
- erase_mode, video_type);
-
- /* put the real cursor on the current column */
- place_cursor_abs (vid, fieldRow, fieldCol +cursorAt);
-
- break; /* end KBF_DEL_TO_SOL case */
-
-
-
- case DELETECHAR: /* delete left of cursor */
- last_valid = 1;
- #if defined(__MSDOS__)
- case DELSTAY:
- if(keyWas == DELSTAY)last_valid = 0;
- #endif
- if (cursorAt >= last_valid)
- {
- /* Move logical cursor to the doomed character
- */
- cursorAt--;
- #if defined(__MSDOS__)
- if(keyWas == DELSTAY)cursorAt++;
- #endif
-
-
- /* shift chars left in buffer starting at
- * cursorAt +1
- */
- for (j=cursorAt; j<endAt; j++)
- tempField[j] = tempField[j+1];
-
- /* Hang a blank on the end to replace
- * the deleted character, so length
- * remains correct and the blanks
- * fill in the line from the right.
- */
- tempField[endAt] = ' ';
-
- /* re-figure the tail of the line,
- * from cursorAt to endAt.
- */
- tailLength = endAt -cursorAt +1;
- cursorCol = fieldCol +cursorAt;
-
- /* re-write the tempField tail to the screen */
- put_chars (vid, &tempField[cursorAt],
- tailLength, fieldRow, cursorCol,
- erase_mode, video_type);
- /* put the real cursor on the current column */
- place_cursor_abs (vid, fieldRow, fieldCol +cursorAt);
-
-
- } /* end if cursorAt > 0 */
-
- break; /* end DELETECHAR case */
-
-
- case KBF_DEL_TO_EOL: /* delete from cursor to end-of-line */
-
- /* Make blanks of cursor and all
- * chars to right of cursor
- */
- for (j=cursorAt; j<=endAt; j++)
- tempField[j] = ' ';
- /* re-figure the tail of the line,
- * from cursorAt to endAt.
- */
- tailLength = endAt -cursorAt +1;
- cursorCol = fieldCol +cursorAt;
-
- /* re-write the tempField tail to the screen */
- put_chars (vid, &tempField[cursorAt],
- tailLength, fieldRow, cursorCol,
- erase_mode, video_type);
-
- /* put the real cursor on the current column */
- place_cursor_abs (vid, fieldRow, fieldCol +cursorAt);
-
- break; /* end KBF_DEL_TO_EOL case */
-
-
- case KBF_TOGGLE_INSERT: /* toggle between insert &
- * overwrite modes
- */
- if (insertMode) insertMode = FALSE;
- else insertMode = TRUE;
-
- break;
-
- /* case KBF_MOVE_SOL: */ /* move cursor to start of line */
- case KBF_MOVE_SOL_ALT:
-
- cursorAt = 0;
- /* put the real cursor on the current column */
- place_cursor_abs (vid, fieldRow, fieldCol +cursorAt);
-
- break;
-
-
- case KBF_MOVE_EOL: /* move cursor to end of line */
- case KBF_MOVE_EOL_ALT:
-
- /* That is, move the cursor
- * to the right of the last
- * non-blank character.
- */
- cursorAt = endAt;
- while ( (tempField[cursorAt] == ' ') &&
- (cursorAt != 0) )
- cursorAt--;
-
- if (cursorAt != endAt)
- cursorAt++;
-
- /* put the real cursor on the current column */
- place_cursor_abs (vid, fieldRow, fieldCol +cursorAt);
-
- break;
-
-
- case KBF_RIGHT: /* move cursor right, non-destructive.
- * Will wrap-around the end of line.
- */
- if (cursorAt < endAt)
- cursorAt++;
- else /* cursorAt == endAt, so wrap around to 0 */
- cursorAt = 0;
-
- /* put the real cursor on the current column */
- place_cursor_abs (vid, fieldRow, fieldCol +cursorAt);
-
- break;
-
- case KBF_LEFT: /* move cursor left, non-destructive.
- * Will wrap-around the start of line.
- */
- if (cursorAt > 0)
- cursorAt--;
- else /* cursorAt == 0, so wrap around to endAt */
- {
- cursorAt = endAt;
-
- /* Put logical cursor at last
- * significant character plus 1.
- */
- while ( (tempField[cursorAt] == ' ') &&
- (cursorAt != 0) )
- cursorAt--;
-
- if (cursorAt != endAt)
- cursorAt++;
- }
-
- /* put the real cursor on the current column */
- place_cursor_abs (vid, fieldRow, fieldCol +cursorAt);
-
- break;
-
- case REDRAW:
- redraw_screen();
- break;
-
- /*
- * These keys cause EXIT of the function (done becomes TRUE)
- */
- case KB_CONTEXT_HELP:
- case KBM_QUIT: /* quit the program */
- case KBF_HELP:
- case KBF_DOWN:
- case KBF_NEXTFIELD:
- case KBF_UP:
- case KBF_PREVFIELD:
- case KBF_EXIT:
- case KBF_POPUP:
- case KBF_ACTION:
- case KB_PAD0:
- case KB_PAD1:
- case KB_PAD2:
- case KB_PAD3:
- case KB_PAD4:
- case KB_PAD5:
- case KB_PAD6:
- case KB_PAD7:
- case KB_PAD_ENTER:
- case KB_PAD_COMMA:
- case KB_PAD_DOT:
- case KB_PF1: /* V1.1 */
- case KB_PF2: /* V1.1 */
- case KB_PF3: /* V1.1 */
- case KB_PF4: /* V1.1 */
-
- done = TRUE;
- break;
-
- } /* switch (keyWas) */
-
- } /* end while !done */
-
- *returnKey = keyWas;
-
- /* Restore the original data field to the contents
- * of tempField, except replace trailing blanks with NULLs.
- */
- for (j=0; j<len; j++)
- {
- field[j] = tempField[j];
- }
- /* back-fill trailing blanks with NULLs */
- j = len-1;
- while ( (field[j] == ' ') && (j >= 0) )
- {
- field[j] = '\0';
- j--;
- }
-
-
- } /* end input_field */
-
-
-
- /*CodeRef-mark*/
-
- void highlight_on ( vid, row, col, num_rows, num_cols)
- WINDOWid vid;
- int row;
- int col;
- int num_rows;
- int num_cols;
-
- /*
- * Turn reverse-video on.
- */
- /*CodeRef-mark*/
- {
- #ifdef vms
- int on = 2;
- #endif
- #if defined(unix) | defined (__MSDOS__)
- int on = REVERSE;
- #endif
- change_rendition(vid, row, col, num_rows, num_cols, on);
- }
-
-
- /*CodeRef-mark*/
-
- void highlight_off (vid, row, col, num_rows, num_cols)
- WINDOWid vid;
- int row;
- int col;
- int num_rows;
- int num_cols;
-
- /*
- * Turn reverse-video off.
- */
- /*CodeRef-mark*/
- {
- long off = 0;
- change_rendition(vid, row, col, num_rows, num_cols, off);
- }
-
-
-
- /*CodeRef-mark*/
-
- void highlight_selection (window_ptr, element_ptr, old_element, new_element)
- struct window_struct *window_ptr;
- struct menu_element_struct *element_ptr[];
- int old_element;
- int new_element;
-
- /*
- * Highlight (reverse video) a selection in a menu.
- */
- /*CodeRef-mark*/
- {
- int num_rows;
- int num_cols;
-
- num_cols = strlen((*element_ptr[old_element]).label);
- num_rows = 1;
- highlight_off((*window_ptr).wind_id,
- (*element_ptr[old_element]).start_row,
- (*element_ptr[old_element]).start_col,
- num_rows, num_cols);
- num_cols = strlen((*element_ptr[new_element]).label);
- num_rows = 1;
- highlight_on((*window_ptr).wind_id,
- (*element_ptr[new_element]).start_row,
- (*element_ptr[new_element]).start_col,
- num_rows, num_cols);
- } /* end highlight_selection */
-
-
- /*CodeRef-mark*/
-
- /*
- * Cursor position functions
- */
-
-
- void get_cursor_pos (vid, row, col)
- WINDOWid vid;
- int *row;
- int *col;
-
- /*
- * NOT SURE OF THIS ONE (dg). Absolute or relative cursor?
- */
- /*CodeRef-mark*/
- {
- return_cursor_pos (vid, row, col);
- }
-
-
-
-
- /*CodeRef-mark*/
-
-
- void get_physical_cursor_pos (row, col)
- int *row;
- int *col;
- /*
- * This function gets the absolute row and column coordinates
- * of the physical cursor.
- */
- /*CodeRef-mark*/
- {
- get_physical_cursor (row, col);
- } /* end get_physical_cursor_pos */
-
-
-
- /*CodeRef-mark*/
- void set_physical_cursor_pos (row, col)
- int row;
- int col;
-
- /*
- * This function SETS the absolute row and column coordinates
- * of the physical cursor.
- */
- /*CodeRef-mark*/
- {
- set_physical_cursor (row, col);
- } /* end set_physical_cursor_pos */
-
-
- /*CodeRef-mark*/
-
- int menu_bar_last_at_row (set_signal)
- int set_signal;
-
- /* This function is for saving and recalling the physical
- * cursor row coordinate.
- * If set_signal is TRUE (!= 0) the row is SAVED and the
- * function returns the saved value.
- * If set_signal is FALSE(== 0) the row is RECALLED --
- * the function returns the last saved row index.
- */
- /*CodeRef-mark*/
- {
- static int physical_row = 0;
- if (set_signal)
- physical_row = set_signal;
-
- return (physical_row);
- } /* end menu_bar_last_at_row */
-
- /*CodeRef-mark*/
-
- int menu_bar_last_at_col (set_signal)
- int set_signal;
-
- /* This function is for saving and recalling the physical
- * cursor column coordinate.
- * If set_signal is TRUE (!= 0) the column is SAVED and the
- * function returns the saved value.
- * If set_signal is FALSE(== 0) the column is RECALLED --
- * the function returns the last saved column index.
- */
- /*CodeRef-mark*/
- {
- static long physical_col = 0;
- if (set_signal)
- physical_col = set_signal;
-
- return (physical_col);
- } /* end menu_bar_last_at_col */
-
-
-
- /*CodeRef-mark*/
-
- /*
- * Utility string functions
- */
-
- #if 0
- void prtext (output, text, format)
- FILE *output;
- char *text[];
- char *format;
-
- /*
- * Print an array of strings (*text[]) to file output using format string.
- * Function iterates on: fprintf (output, format, text[j]);
- * A null string signals end of the array.
- */
- /*CodeRef-mark*/
- {
- long j, nullstring = 0;
- for (j=0; text[j][0] != nullstring; j++)
- fprintf (output, format, text[j]);
- }
- #endif
-
-
- /*CodeRef-mark*/
- int longest_string (text)
- char *text[];
-
- /*
- * Function returns the length of the longest string
- * in an array of strings (*text[]).
- * The function iterates strlen() on the list of strings.
- * A null string MUST mark the end of the array of strings.
- */
- /*CodeRef-mark*/
- {
- long j;
- /*char nullstring = 0;*/ /*jtl*/
- int maxlen = 0L;
-
- for (j=0; text[j][0] != '\0'; j++)
- if (strlen(text[j]) > maxlen) maxlen = strlen(text[j]);
- return (maxlen);
- } /* end longest_string */
-
-
- /*CodeRef-mark*/
- int string_count (text)
- char *text[];
-
- /*
- * Function returns the number of strings
- * in an array of strings (*text[]).
- * A null string MUST mark the end of the array of strings,
- * but the null string is not part of the count.
- */
- /*CodeRef-mark*/
- {
- int count = 0L;
-
- for (count=0; text[count][0] != '\0'; count++);
- return (count);
- } /* end string_count */
-
-
-
-
-
- void end_it(text, index)
- char *text[];
- int index;
-
- {
- char nullstring = 0;
-
- text[index][0] = nullstring;
-
- } /* end end_it*/
-
-
-
-
-
-
-
-
-
-